package org.kotboot.ctrl

import org.kotboot.module.R
import org.kotboot.service.CommodityServ
import org.slf4j.LoggerFactory
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import javax.annotation.Resource

/**
 * jisong.sun 2017/9/18 16:43
 */

@RestController
@RequestMapping(value = "/commodity")
open class CommodityCtrl(
        @Resource val commodityServ: CommodityServ
) : BaseCtrl() {
    val log = LoggerFactory.getLogger(CommodityCtrl::class.java)

    @RequestMapping("/list")
    fun list(): R<*> {
        val params = getParams()
        return commodityServ.page(params)
    }

    @RequestMapping("/byId")
    fun quaryById(commodityid: String?): R<*> {
        return if (null == commodityid) {
            R.ER("缺少主键")
        } else commodityServ.quaryById(commodityid)
    }

}